import * as API from '@/services';
import {
  KfBackendEnumPicker,
  DEFAULT_FORM_LAYOUT,
  KfBizQuickFormProps,
  KfFloatingContextProps,
  KfInput,
  KfQuickForm,
  KfTextArea,
  KfUpload,
  KfUserPicker,
} from 'kf-web-library';
import { Form } from 'antd';
import React, { FunctionComponent } from 'react';
import HxJournalPicker from '@/components/HxJournalPicker';
import HxJournalPeriodPicker from '@/components/HxJournalPeriodPicker';
import HxJournalColumnPicker from '@/components/HxJournalColumnPicker';
import { Article_SpecialTopicIdModify, ChiefSelected_Create } from '@/services';
import HxJournalSpecialTopicPicker from '@/components/HxJournalSpecialTopicPicker';

const FormItem = Form.Item;
type ModifyEntity = API.ChiefSelected_Create;

type DataFormProps = {} & KfBizQuickFormProps & KfFloatingContextProps;

/**
 * 文章 表单
 */
const ChiefSelectedQuickForm: FunctionComponent<DataFormProps> = (props) => {
  const { formType, bizId, ...rest } = props;

  return (
    <KfQuickForm
      formType={'create'}
      formProps={{
        labelCol: {
          flex: '0 0 140px',
        },
        wrapperCol: {
          flex: '1',
        },
      }}
      submitRequest={{
        create: (formValues) => API.createChiefSelected({ selectedReason: formValues.selectedReason, articleId: bizId } as ModifyEntity),
      }}
      {...rest}
    >
      <FormItem name={nameof<ModifyEntity>((x) => x.selectedReason)} label="入选编辑精选理由" rules={[{ required: true }]}>
        <KfTextArea rows={3} />
      </FormItem>
    </KfQuickForm>
  );
};

export default ChiefSelectedQuickForm;
